#1234567890

import sys
import os
import json
str = sys.stdin.readline()
print(str)

num = input("请输入一个数字")
print(num)

sys.stdout.write('Hello')
print('World')

file = open('a.txt' , 'r',encoding='utf-8',buffering=1)
print(file.read())
file.close()

with open('a.txt' , 'r',encoding='utf-8',buffering=1) as file2:
    # \n换行符
    #print(file2.readline())
    #print(file2.readline())
    print(file2.readlines())
with open('a.txt' ,'w',encoding='utf-8',buffering=1) as file3:
    file3.write('爽肤水')
#a 模式 代表追加写入
with open('a.txt' , 'a',encoding='utf-8',buffering=1) as file4:
    file4.write('欧莱雅')
with open('a.txt') as file5:
    print(file5.tell())
# 获取当前目录
print(os.getcwd())
# 获取目录列表
print(os.listdir())
# 更改默认目录
# os.chdir('a.txt')

#使用dumps()函数对Python对象进行转码
pyobj = [[1, 2, 3], 345, 23.12, 'qwe', {'key1':(1,2,3), 'key2':(2,3,4)}, True, False, None]
jsonstr = json.dumps(pyobj)
print(jsonstr)
#[[1, 2, 3], 345, 23.12, "qwe", {"key1": [1, 2, 3], "key2": [2, 3, 4]}, true, false, null]

#使用loads()函数将JSON数据转换为符合Python语法要求的数据类型
jsonstr = '[{"name": "Alice"}, {"name": "Bob"}]'  # 这是一个 JSON 字符串
pydata = json.loads(jsonstr)  # 正确用法
print(pydata)